package com.wnxy.pawnbackgroundsystem.dao;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wnxy.pawnbackgroundsystem.entity.Goods;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 商品详情表 Mapper 接口
 * </p>
 *
 * @author Lucas
 * @since 2021-10-14
 */
public interface GoodsMapper extends BaseMapper<Goods> {

    @Select("<script>" +
            "select * from pawn_goods " +
            "<where> " +
            "<if test='goodsName!=null'> " +
            "goods_name = #{goodsName}" +
            "</if>" +
            "<if test='sortName!=null'>  " +
            "sort_name = #{sortName}" +
            "</if>" +
            "<if test='goodsStatus!=null '> " +
            "goods_status = #{goodsStatus}" +
            "</if>" +
            "<if test='StartTime!=null and EndTime!=null'>  " +
            "and goods_entering_time between #{StartTime} and #{EndTime}" +
            "</if>" +
            "</where>" +
            "</script>")
    IPage<Goods> findAllGoodsByPage(IPage<Goods> page,String goodsName,String sortName,String goodsStatus,Long StartTime,Long EndTime);

}
